package mapping

import (
	"auth/model"
	"auth/model/entity"
)

// UsersEntityToDto entity data transfer
func UsersEntityToDto(users []*entity.User) []*model.UserInfo {
	out := make([]*model.UserInfo, 0, len(users))
	for _, c := range users {
		out = append(out, UserEntityToDto(c))
	}
	return out
}

// UserEntityToDto entity data transfer
func UserEntityToDto(e *entity.User) *model.UserInfo {
	return &model.UserInfo{

		Id: e.Id,

		Username: e.Username,

		Password: e.Password,

		Salt: e.Salt,

		Nickname: e.Nickname,

		Email: e.Email,

		Phone: e.Phone,

		RoleID: e.RoleID,

		Status: e.Status,

		ActiveState: e.ActiveState,

		LastLoginAt: e.LastLoginAt,

		CreatedAt: e.CreatedAt,

		UpdatedAt: e.UpdatedAt,
	}
}
